<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>行程预览</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
    <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
    <link rel="stylesheet" href="__CSS__/admin.css"  media="all">

    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
    <style>
        .layui-form-item .layui-input-inline{
            width: 500px;
        }
        .pois dl{
            z-index:1000;
        }
    </style>
</head>
<body>
<div class="layui-tab layui-tab-card" style="box-shadow: none">
    <ul class="layui-tab-title">
        <li {if !empty($typeid)&&$typeid=='1'} class="layui-this" {/if}>机场</li>
        <li {if !empty($typeid)&&$typeid=='2'} class="layui-this" {/if}>城市</li>
        <li {if empty($typeid)||$typeid=='3'} class="layui-this" {/if}>POI</li>
        <li {if !empty($typeid)&&$typeid=='6'} class="layui-this" {/if}>商品</li>
        <li {if !empty($typeid)&&$typeid=='4'} class="layui-this" {/if}>其他</li>
    </ul>
    <div class="layui-tab-content">
        <div class="layui-tab-item {if !empty($typeid)&&$typeid=='1'}layui-show{/if}">
            <form class="layui-form" id="airport">
                {notempty name="$groupid"}
                <input type="hidden" name="groupid" value="{$groupid}">
                {/notempty}

                {notempty name="$menu.id"}
                <input type="hidden" name="id" value="{$menu.id}">
                {/notempty}

                <input type="hidden" name="typeid" value="1">
                <div class="layui-form-item">
                    <label class="layui-form-label">所属城市</label>
                    <div class="layui-input-inline">
                        <select name="cityname"  lay-filter="airportcity" lay-verify="required" lay-search>
                            {volist name="city" id="vo"}
                            <option value="{$vo.name}" {if $menu.cityname==$vo.name} selected{/if}>{$vo.name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">机场</label>
                    <div class="layui-input-inline">
                        <select name="airportPlace" id="airportPlace" lay-search>
                            <option value>暂无</option>
                            {volist name="airportPlace" id="vo"}
                            <option value="{$vo.id}" {if $menu.airportPlace==$vo.id} selected{/if}>{$vo.name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">接送类型</label>
                    <div class="layui-input-inline">
                        <select name="portType"  lay-filter="airportType" lay-search>
                            <option value="Transport_Vehicle_FromAirport" {if $menu.portType=='Transport_Vehicle_FromAirport'} selected{/if}>接机</option>
                            <option value="Transport_Vehicle_ToAirport" {if $menu.portType=='Transport_Vehicle_ToAirport'} selected{/if}>送机</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">时间</label>
                    <div class="layui-input-inline">
                        <input name="time" value="{$menu.time}"  id="airporttime"  placeholder="请输入" autocomplete="off" class="layui-input" type="text">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">内容</label>
                    <div class="layui-input-inline">
                        <textarea placeholder="请输入内容" class="layui-textarea" name="content">{$menu.content}</textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">地图起始点</label>
                    <div class="layui-input-inline">
                        <input type="radio" name="mapmark" value="起点" title="起点" {if $menu.mapmark=='起点'}checked=""{/if} >
                        <input type="radio" name="mapmark" value="途经" title="途经" {if $menu.mapmark=='途经'}checked=""{/if}>
                        <input type="radio" name="mapmark" value="终点" title="终点" {if $menu.mapmark=='终点'}checked=""{/if}>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="airport">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="layui-tab-item {if !empty($typeid)&&$typeid=='2'}layui-show{/if}">
            <form class="layui-form" id="citys">
                <input type="hidden" name="typeid" value="2">

                {notempty name="$groupid"}
                <input type="hidden" name="groupid" value="{$groupid}">
                {/notempty}

                {notempty name="$menu.id"}
                <input type="hidden" name="id" value="{$menu.id}">
                {/notempty}

                <div class="layui-form-item">
                    <label class="layui-form-label">城市</label>
                    <div class="layui-input-inline">
                        <select name="cityname" lay-verify="required" lay-search>
                            {volist name="city" id="vo"}
                            <option value="{$vo.name}" {if $menu.cityname==$vo.name} selected{/if}>{$vo.name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">包车类型</label>
                    <div class="layui-input-inline">
                        <select name="portType"  lay-filter="airportType" lay-search>
                            <option value>不使用包车</option>
                            <option value="Transport_Vehicle_HalfDay" {if $menu.portType=='Transport_Vehicle_HalfDay'} selected{/if}>市区半日包车</option>
                            <option value="Transport_Vehicle_OneDay" {if $menu.portType=='Transport_Vehicle_OneDay'} selected{/if}>市区1日包车</option>
                            <option value="Transport_Vehicle_Around" {if $menu.portType=='Transport_Vehicle_Around'} selected{/if}>周边1日包车</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">时间</label>
                    <div class="layui-input-inline">
                        <input name="time" value="{$menu.time}"  id="citystime"   placeholder="请输入" autocomplete="off" class="layui-input" type="text">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">内容</label>
                    <div class="layui-input-inline">
                        <textarea placeholder="请输入内容" class="layui-textarea" name="content">{$menu.content}</textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">地图起始点</label>
                    <div class="layui-input-inline">
                        <input type="radio" name="mapmark" value="起点" title="起点" {if $menu.mapmark=='起点'}checked=""{/if} >
                        <input type="radio" name="mapmark" value="途经" title="途经" {if $menu.mapmark=='途经'}checked=""{/if}>
                        <input type="radio" name="mapmark" value="终点" title="终点" {if $menu.mapmark=='终点'}checked=""{/if}>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="citys">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="layui-tab-item {if empty($typeid)||$typeid=='3'}layui-show{/if}">
            <form class="layui-form" id="poi">

                {notempty name="$groupid"}
                <input type="hidden" name="groupid" value="{$groupid}">
                {/notempty}

                {notempty name="$menu.id"}
                <input type="hidden" name="id" value="{$menu.id}">
                {/notempty}

                <input type="hidden" name="typeid" value="3">
                <div class="layui-form-item poicity">
                    <label class="layui-form-label">POI城市</label>
                    <div class="layui-input-inline" id="poicity">
                        <select name="cityname"  lay-filter="poicity" lay-verify="required" lay-search>
                            {volist name="city" id="vo"}
                            <option value="{$vo.name}" {if $menu.cityname==$vo.name} selected{/if}>{$vo.name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">POI类型</label>
                    <div class="layui-input-inline" id="poitype">
                        <input type="radio"  lay-filter="poitype" name="poitype" value="1" title="景点" {if $menu.poitype=='1'||$menu.poitype==""}checked=""{/if}>
                        <input type="radio"  lay-filter="poitype" name="poitype" value="2" title="酒店" {if $menu.poitype=='2'}checked=""{/if}>
                        <input type="radio"  lay-filter="poitype" name="poitype" value="3" title="其他" {if $menu.poitype=='3'}checked=""{/if}>
                    </div>
                </div>
                <div class="layui-form-item pois">
                    <label class="layui-form-label">POI</label>
                    <div class="layui-input-inline" style="width: 400px">
                        <select name="poi_id" id="citypoi"lay-filter="checkcitypoi"  lay-verify="required" lay-search>
                            {volist name="citypoi" id="vo"}
                            <option value="{$vo.id}" {if $menu.poiid==$vo.id} selected{/if}>{$vo.name}</option>
                            {/volist}
                        </select>
                    </div>
                    <span id="seepoi" {if $menu.poiid>0}data-id="{$menu.poiid}"{else} {if isset($citypoi[0]["id"])}data-id="{$citypoi[0]["id"]}" {/if} {/if} class="layui-btn layui-btn-danger layui-btn-sm" style="margin-top: 4px">详情</span>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">POI图片</label>
                    <input type="hidden" id="poiImg" name="poiImg" value="{notempty name='$poiImgValue'}{$poiImgValue}{/notempty}">
                    <a href="" class="layui-btn layui-btn-sm poiImg_btn">
                        打开图片库
                    </a>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-inline" id="poiImgShow">
                        {volist name="$poiImg" id="vo"}
                        {if !empty($vo)}
                        <span><img class="layui-upload-img" src="{$vo}" style="width:100px;padding:5px;"><i class="layui-icon">&#x1006;</i></span>
                        {/if}
                        {/volist}
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">POI中文简介</label>
                    <div class="layui-input-block" style="max-width:500px;">
                        <textarea placeholder="请输入内容" id="poi_content" class="layui-textarea" name="poi_content">{if isset($menu['poi_content'])}{$menu.poi_content}{else}{if isset($citypoi[0]['introduce'])}{$citypoi[0]['introduce']}{/if}{/if}</textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">包车类型</label>
                    <div class="layui-input-inline">
                        <select name="portType"  lay-filter="airportType" lay-search>
                            <option value>不使用包车</option>
                            <option value="Transport_Vehicle_HalfDay" {if $menu.portType=='Transport_Vehicle_HalfDay'} selected{/if}>市区半日包车</option>
                            <option value="Transport_Vehicle_OneDay" {if $menu.portType=='Transport_Vehicle_OneDay'} selected{/if}>市区1日包车</option>
                            <option value="Transport_Vehicle_Around" {if $menu.portType=='Transport_Vehicle_Around'} selected{/if}>周边1日包车</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">时间</label>
                    <div class="layui-input-inline">
                        <input name="time" value="{$menu.time}"  id="poitime"  placeholder="请输入" autocomplete="off" class="layui-input" type="text">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">门票</label>
                    <div class="layui-input-inline">
                        <input name="tickit" id="tickit" {notempty name="$menu.tickit"}value="{$menu.tickit}"{/notempty} placeholder="请输入" autocomplete="off" class="layui-input" type="text">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">门票详情</label>
                    <div class="layui-input-inline">
                        <textarea placeholder="请输入内容" id="tickitDetails" class="layui-textarea" name="tickitDetails">{notempty name="$menu.tickitDetails"}{$menu.tickitDetails}{/notempty}</textarea>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">购买价格(RMB)</label>
                    <div class="layui-input-inline">
                        <input name="tickitPrice" {notempty name="$menu.tickitPrice"}value="{$menu.tickitPrice}"{/notempty} placeholder="请输入" autocomplete="off" class="layui-input" type="number">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">购买详情</label>
                    <div class="layui-input-inline">
                        <textarea placeholder="请输入购买详情" class="layui-textarea" name="tickitBuyDetails">{notempty name="$menu.tickitBuyDetails"}{$menu.tickitBuyDetails}{/notempty}</textarea>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">地图起始点</label>
                    <div class="layui-input-inline">
                        <input type="radio" name="mapmark" value="起点" title="起点" {if $menu.mapmark=='起点'}checked=""{/if} >
                        <input type="radio" name="mapmark" value="途经" title="途经" {if $menu.mapmark=='途经'}checked=""{/if}>
                        <input type="radio" name="mapmark" value="终点" title="终点" {if $menu.mapmark=='终点'}checked=""{/if}>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">展示信息</label>
                    <div class="layui-input-inline">
                        <input type="checkbox" name="showmobile" title="联系方式" {if $menu.showmobile=='1'}checked=""{/if}>
                        <input type="checkbox" name="showticket" title="门票信息" {if $menu.showticket=='1'}checked=""{/if}>
                        <input type="checkbox" name="showopen_time" title="开放时间" {if $menu.showopen_time=='1'}checked=""{/if}>
                        <input type="checkbox" name="showticket_url" title="订票官网"  {if $menu.showticket_url=='1'}checked=""{/if}>
                        <input type="checkbox" name="showeng_introduce" title="英文介绍" {if $menu.showeng_introduce=='1'}checked=""{/if}>
                        <input type="checkbox" name="showdescription" title="特别说明" {if $menu.showdescription=='1'}checked=""{/if}>
                        <input type="checkbox" name="showprice" title="价格"  {if $menu.showprice=='1'}checked=""{/if}>
                        <input type="checkbox" name="showthumb" title="图片" {if $menu.showthumb!='0'}checked=""{/if}>
                        <input type="checkbox" name="showsource" title="来源" {if $menu.showsource=='1'}checked=""{/if}>
                        <input type="checkbox" name="showaddress" title="地址" {if $menu.showaddress!='0'}checked=""{/if}>
                        <input type="checkbox" name="showgrade" title="星级"{if $menu.showgrade=='1'}checked=""{/if}>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="poi">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>

        <div class="layui-tab-item {if !empty($typeid)&&$typeid=='6'}layui-show{/if}">
            <form class="layui-form" id="goods">
                {notempty name="$groupid"}
                <input type="hidden" name="groupid" value="{$groupid}">
                {/notempty}

                {notempty name="$menu.id"}
                <input type="hidden" name="id" value="{$menu.id}">
                {/notempty}

                <input type="hidden" name="typeid" value="6">
                <div class="layui-form-item">
                    <label class="layui-form-label">商品</label>
                    <div class="layui-input-inline">
                        <select name="goodsid"  lay-filter="goodsid" lay-verify="required" lay-search>
                            {volist name="goods" id="vo"}
                            <option value="{$vo.goods_id}" {if $menu.title==$vo.goods_name} selected{/if}>{$vo.goods_name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">包车类型</label>
                    <div class="layui-input-inline">
                        <select name="portType"  lay-filter="airportType" lay-search>
                            <option value>不使用包车</option>
                            <option value="Transport_Vehicle_HalfDay" {if $menu.portType=='Transport_Vehicle_HalfDay'} selected{/if}>市区半日包车</option>
                            <option value="Transport_Vehicle_OneDay" {if $menu.portType=='Transport_Vehicle_OneDay'} selected{/if}>市区1日包车</option>
                            <option value="Transport_Vehicle_Around" {if $menu.portType=='Transport_Vehicle_Around'} selected{/if}>周边1日包车</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">时间</label>
                    <div class="layui-input-inline">
                        <input name="time" value="{$menu.time}"  id="goodstime"  placeholder="请输入" autocomplete="off" class="layui-input" type="text">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">购买价格(RMB)</label>
                    <div class="layui-input-inline">
                        <input name="goodsPrice" {notempty name="$menu.goodsPrice"}value="{$menu.goodsPrice}"{/notempty} placeholder="请输入" autocomplete="off" class="layui-input" type="number">
                    </div>
                </div>

                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="goods">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="layui-tab-item {if !empty($typeid)&&$typeid=='4'}layui-show{/if}">
            <form class="layui-form" id="other">

                {notempty name="$groupid"}
                <input type="hidden" name="groupid" value="{$groupid}">
                {/notempty}

                {notempty name="$menu"}
                <input type="hidden" name="id" value="{$menu.id}">
                {/notempty}

                <input type="hidden" name="typeid" value="4">
                <div class="layui-form-item">
                    <label class="layui-form-label">标题</label>
                    <div class="layui-input-inline">
                        <input name="title" value="{$menu.title}" lay-verify="required"   placeholder="请输入" autocomplete="off" class="layui-input" type="text">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">城市</label>
                    <div class="layui-input-inline">
                        <select name="cityname" lay-verify="required" lay-search>
                            {volist name="city" id="vo"}
                            <option value="{$vo.name}" {if $menu.cityname==$vo.name} selected{/if}>{$vo.name}</option>
                            {/volist}
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">包车类型</label>
                    <div class="layui-input-inline">
                        <select name="portType"  lay-filter="airportType" lay-search>
                            <option value>不使用包车</option>
                            <option value="Transport_Vehicle_HalfDay" {if $menu.portType=='Transport_Vehicle_HalfDay'} selected{/if}>市区半日包车</option>
                            <option value="Transport_Vehicle_OneDay" {if $menu.portType=='Transport_Vehicle_OneDay'} selected{/if}>市区1日包车</option>
                            <option value="Transport_Vehicle_Around" {if $menu.portType=='Transport_Vehicle_Around'} selected{/if}>周边1日包车</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">返程时间</label>
                    <div class="layui-input-inline">
                        <input name="time" value="{$menu.time}"  id="othertime"  placeholder="返程时间" autocomplete="off" class="layui-input" type="text">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">到达时间</label>
                    <div class="layui-input-inline">
                        <input name="arrival_time" value="{$menu.arrival_time}"  id="arrival_time"  placeholder="到达时间(不是当天最后活动无需填写)" autocomplete="off" class="layui-input" type="text">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">内容</label>
                    <div class="layui-input-inline">
                        <textarea placeholder="请输入内容" class="layui-textarea" name="content">{$menu.content}</textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">上传图片</label>
                    <div class="layui-input-inline">
                        <div class="layui-upload">
                            <button type="button" class="layui-btn" id="upload1">图片上传（格式：jpg,png,gif,jpeg）                                                                                      </button>
                            <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
                                预览图：
                                <div class="layui-upload-list" id="seeupload1">
                                    <span class="uploadimgbox"></span>
                                    {notempty name='$otherimages'}
                                    {volist name="$otherimages" id="vo"}
                                    {notempty name='$vo'}
                                    <span class="uploadimgbox"><img class="layui-upload-img" src="{$vo}" width="100px"><i class="layui-icon">&#x1006;</i></span>
                                    {/notempty}
                                    {/volist}
                                    {/notempty}
                                </div>
                            </blockquote>
                        </div>
                    </div>
                </div>
                <input id="upload-thumb1" type="hidden" name="other_images" value="{notempty name='$menu.other_images'}{$menu.other_images}{/notempty}">
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="other">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<script src="__PUBLIC__/layui/layui.js"></script>
<script src="__PUBLIC__/jquery/jquery.min.js"></script>
<script>
    layui.use('layedit', function(){
        var layedit = layui.layedit;
        layedit.build('spotschaintroduce'); //建立编辑器
    });
</script>
<script>
    layui.use('laydate', function(){
        var laydate = layui.laydate;

        laydate.render({
            elem: '#airporttime'
            ,type: 'time'
            ,format: 'HH:mm'
        });

        laydate.render({
            elem: '#citystime'
            ,type: 'time'
            ,format: 'HH:mm'
        });
        laydate.render({
            elem: '#poitime'
            ,type: 'time'
            ,format: 'HH:mm'
        });

        laydate.render({
            elem: '#teamtime'
            ,type: 'time'
            ,format: 'HH:mm'
        });

        laydate.render({
            elem: '#othertime'
            ,type: 'time'
            ,format: 'HH:mm'
        });
        laydate.render({
            elem: '#arrival_time'
            ,type: 'time'
            ,format: 'HH:mm'
        });
        laydate.render({
            elem: '#goodstime'
            ,type: 'time'
            ,format: 'HH:mm'
        });
    });
</script>

{if empty($typeid)}

<script>
    layui.use('element', function(){
        var $ = layui.jquery
            ,element = layui.element; //Tab的切换功能，切换事件监听等，需要依赖element模块

        //触发事件
        var active = {
            tabAdd: function(){
                //新增一个Tab项
                element.tabAdd('demo', {
                    title: '新选项'+ (Math.random()*1000|0) //用于演示
                    ,content: '内容'+ (Math.random()*1000|0)
                    ,id: new Date().getTime() //实际使用一般是规定好的id，这里以时间戳模拟下
                })
            }
            ,tabDelete: function(othis){
                //删除指定Tab项
                element.tabDelete('demo', '44'); //删除：“商品管理”


                othis.addClass('layui-btn-disabled');
            }
            ,tabChange: function(){
                //切换到指定Tab项
                element.tabChange('demo', '22'); //切换到：用户管理
            }
        };

        $('.site-demo-active').on('click', function(){
            var othis = $(this), type = othis.data('type');
            active[type] ? active[type].call(this, othis) : '';
        });

        //Hash地址的定位
        var layid = location.hash.replace(/^#test=/, '');
        element.tabChange('test', layid);

        element.on('tab(test)', function(elem){
            location.hash = 'test='+ $(this).attr('lay-id');
        });

    });
</script>

{/if}
<script>
    layui.use(['layer', 'form'], function() {
        var layer = layui.layer,
            $ = layui.jquery,
            form = layui.form;
        $(window).on('load', function() {
            form.on('submit(airport)', function(data) {
                $.ajax({
                    url:"{:url('admin/trip/addactive')}",
                    data:$('#airport').serialize(),
                    type:'post',
                    async: false,
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                            },1500)
                        }
                    }
                })
                return false;
            });


            $("#seepoi").on("click",function () {
                var id=$(this).attr("data-id");
                if(!id){
                    layer.msg("没有POI信息");
                    return false;
                }
                var activeurl="/admin/trip/activesee/id/"+id+".shtml";
                layer.open({
                    type:2,
                    content:activeurl,
                    area: ['600px', '500px'],
                    end:function(){
//                    location.reload();
                    }
                });
            })
            form.on('submit(citys)', function(data) {
                $.ajax({
                    url:"{:url('admin/trip/addactive')}",
                    data:$('#citys').serialize(),
                    type:'post',
                    async: false,
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                            },1500)
                        }
                    }
                })
                return false;
            });
            form.on('submit(poi)', function(data) {
                $.ajax({
                    url:"{:url('admin/trip/addactive')}",
                    data:$('#poi').serialize(),
                    type:'post',
                    async: false,
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                            },1500)
                        }
                    }
                })
                return false;
            });

            form.on('submit(other)', function(data) {
                $.ajax({
                    url:"{:url('admin/trip/addactive')}",
                    data:$('#other').serialize(),
                    type:'post',
                    async: false,
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                            },1500)
                        }
                    }
                })
                return false;
            });
            form.on('submit(goods)', function(data) {
                $.ajax({
                    url:"{:url('admin/trip/addactive')}",
                    data:$('#goods').serialize(),
                    type:'post',
                    async: false,
                    success:function(res) {
                        layer.msg(res.msg);
                        if(res.code == 1) {
                            setTimeout(function(){
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                            },1500)
                        }
                    }
                })
                return false;
            });
            form.on('select(airportcity)', function(data){
                //从订单系统接口获取机场
                $.ajax({
                    url:"{:url('admin/trip/kbxGetAirport')}",
                    data:{
                        cityname:data.value
                    },
                    type:'post',
                    async: false,
                    success:function(res) {
                        if(res.code == 1) {
                            var data=res.data;
                            if(data.length>0){
                                var airportbox="";
                                for(var i = 0;i<data.length;i++){
                                    airportbox+='<option value="'+data[i].id+'">'+data[i].name+'</option>'
                                };
                                $("#airportPlace").html("<option value>暂无</option>"+airportbox);
                            }else{
                                $("#airportPlace").html("");
                            }
                            form.render('select');
                        }
                    }
                })
            });

            form.on('select(poicity)', function(data){
                var poitype="";
                $("#poitype input").each(function () {
                    if($(this).prop('checked')){
                        poitype=$(this).val();
                    }
                })
                $.ajax({
                    url:"{:url('admin/trip/selectpoi')}",
                    data:{
                        name:data.value,
                        poitype:poitype,
                        typeid:6
                    },
                    type:'post',
                    async: false,
                    success:function(res) {
                        if(res.code == 1) {
                            var data=res.data;
                            if(data.length>0){
                                var airportbox="";
                                for(var i = 0;i<data.length;i++){
                                    airportbox+='<option value="'+data[i].id+'">'+data[i].name+'</option>'
                                };
                                $("#citypoi").html(airportbox);
                                $("#seepoi").attr('data-id',data[0]['id']);
                                $("#tickitDetails").html(data[0].tickitDetails);
                                $("#tickit").val(data[0].tickit);
                                setPoiContent(data[0]['introduce']);
                            }else{
                                $("#tickitDetails").html("");
                                $("#tickit").val("");
                                $("#citypoi").html("");
                                $("#seepoi").attr('data-id',"");
                                setPoiContent("");
                            }
                            form.render('select');
                        }
                    }
                });

                //更换图片
                $.ajax({
                    url:"{:url('admin/trip/getPoiImg')}",
                    data:{
                        poitype:poitype,
                        cityname:data.value,
                    },
                    type:'post',
                    async: false,
                    success:function(res) {
                        var poiImg=res.data.poiImg;

                        var thumbs="";
                        var poiImgStr = "";
                        for(var i=0;i<poiImg.length;i++){
                            if(poiImg[i]!==''){
                                thumbs+=","+poiImg[i];
                                poiImgStr += "<span><img class='layui-upload-img' src='"+poiImg[i]+"' style='width:100px;padding:5px;'><i class='layui-icon'>&#x1006;</i></span>";
                            }
                        }

                        $("#poiImg").attr("value",thumbs);
                        $("#poiImgShow").html(poiImgStr);
                    }
                });
                return false;
            });


            form.on('select(checkcitypoi)', function(data){
                $("#seepoi").attr('data-id',data.value);
                $.ajax({
                    url:"{:url('admin/trip/getTickit')}",
                    data:{
                        id:data.value
                    },
                    type:'post',
                    async: false,
                    success:function(res) {
                        var data=res.data.tickit;
                        var poiImg=res.data.poiImg;
                        var poi_content = data.introduce;
                        setPoiContent(poi_content);
                        if(data.tickit!==null){
                            $("#tickit").val(data.tickit);
                            $("#tickit").attr("value",data.tickit);
                        }else{
                            $("#tickit").val("");
                            $("#tickit").attr("value","");
                        }
                        if(data.tickitDetails!==null){
                            $("#tickitDetails").html(data.tickitDetails);
                            $("#tickitDetails").attr("value",data.tickitDetails);
                        }else{
                            $("#tickitDetails").html("");
                            $("#tickitDetails").attr("value","");
                        }

                        var thumbs="";
                        var poiImgStr = "";
                        for(var i=0;i<poiImg.length;i++){
                            if(poiImg[i]!==''){
                                thumbs+=","+poiImg[i];
                                poiImgStr += "<span><img class='layui-upload-img' src='"+poiImg[i]+"' style='width:100px;padding:5px;'><i class='layui-icon'>&#x1006;</i></span>";
                            }
                        }

                        $("#poiImg").attr("value",thumbs);

                        $("#poiImgShow").html(poiImgStr);
                    }
                });
                return false;
            });

            form.on('radio(poitype)', function(data){
                var cityname=$("#poicity .layui-select-title input").eq(0).val();
                $.ajax({
                    url:"{:url('admin/trip/selectpoi')}",
                    data:{
                        name:cityname,
                        poitype:data.value,
                        typeid:6
                    },
                    type:'post',
                    async: false,
                    success:function(res) {
                        if(res.code == 1) {
                            var data=res.data;
                            if(data.length>0){
                                var airportbox="";
                                for(var i = 0;i<data.length;i++){
                                    airportbox+='<option value="'+data[i].id+'">'+data[i].name+'</option>'
                                };
                                $("#citypoi").html(airportbox);
                                $("#seepoi").attr('data-id',data[0]['id']);
                                setPoiContent(data[0]['introduce']);
                            }else{
                                $("#citypoi").html("");
                                $("#seepoi").attr('data-id','');
                                setPoiContent("");
                            }
                            form.render('select');
                        }
                    }
                });

                //更换图片
                $.ajax({
                    url:"{:url('admin/trip/getPoiImg')}",
                    data:{
                        poitype:data.value,
                        cityname:cityname,
                    },
                    type:'post',
                    async: false,
                    success:function(res) {
                        var poiImg=res.data.poiImg;

                        var thumbs="";
                        var poiImgStr = "";
                        for(var i=0;i<poiImg.length;i++){
                            if(poiImg[i]!==''){
                                thumbs+=","+poiImg[i];
                                poiImgStr += "<span><img class='layui-upload-img' src='"+poiImg[i]+"' style='width:100px;padding:5px;'><i class='layui-icon'>&#x1006;</i></span>";
                            }
                        }

                        $("#poiImg").attr("value",thumbs);
                        $("#poiImgShow").html(poiImgStr);
                    }
                });
                return false;
            });


            form.on('select(teamcity)', function(data){
                $.ajax({
                    url:"{:url('admin/trip/selectpoi')}",
                    data:{
                        name:data.value,
                        typeid:8
                    },
                    type:'post',
                    async: false,
                    success:function(res) {
                        if(res.code == 1) {
                            var data=res.data;
                            if(data.length>0){
                                var airportbox="";
                                for(var i = 0;i<data.length;i++){
                                    airportbox+='<option value="'+data[i].name+'">'+data[i].name+'</option>'
                                };
                                $("#teampoi").html(airportbox);
                            }else{
                                $("#teampoi").html("");
                            }
                            form.render('select');
                        }
                    }
                })
            });
        });
    });


    //文件上传
    layui.use('upload', function(){
        var upload = layui.upload;
        //多图片上传
        upload.render({
            elem: '#upload1'
            ,url: "{:url('common/upload')}"
            ,multiple: true
            ,accept:"images"
            ,size:"50000"
            ,done: function(res){
                console.log(res);
                //上传完毕回调
                layer.closeAll('loading');
                if(res.code == 2) {
                    $('#seeupload1').append('<span class="uploadimgbox"><img class="layui-upload-img" src="'+res.src+'" style="width:100px;"><i class="layui-icon">&#x1006;</i></span>');
                    $('#upload-thumb1').val($('#upload-thumb1').val()+","+res.src);
                } else {
                    layer.msg(res.msg);
                }
            }
            ,error: function(){
                //请求异常回调
                layer.closeAll('loading');
                //演示失败状态，并实现重传
                var demoText = $('#demoText');
                demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-mini demo-reload">重试</a>');
                demoText.find('.demo-reload').on('click', function(){
                    uploadInst.upload();
                });
            }
            ,before:function(){
                layer.load(2);
            }
        });
    });

    $("#seeupload1").on("click",".layui-icon",function(){
        $(this).parent().remove();
        thumb("seeupload1",1);
    });

    function thumb(obj,n){
        var thumbs="";
        $("#"+obj).find("img").each(function(){
            var url=$(this).attr("src");
            thumbs+=","+url;
        });
        $("#upload-thumb"+n).val(thumbs);
    }


    $('.poiImg_btn').click(function(){
        var id = $("#seepoi").attr('data-id');
        var url="/admin/trip/addpoiimg/id/"+id+".shtml";
        layer.open({
            type:2,
            content:url,
            area: ['600px', '600px'],
            end:function(){
                return false;
            }
        });

        return false;
    });

    $("#poiImgShow").on("click",".layui-icon",function(){
        $(this).parent().remove();
        poiImg_thumb();
    });

    function poiImg_thumb(){
        var thumbs="";
        $("#poiImgShow").find("img").each(function(){
            var url=$(this).attr("src");
            thumbs+=","+url;
        });
        $("#poiImg").attr("value",thumbs);
    }

    function setPoiContent(text)
    {
        if(text==undefined || text==null || text==0){
            text = "";
        }
        ue.setContent(text);
    }
</script>
<!-- 配置文件 -->
<script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="__PUBLIC__/ueditor/ueditor.all.js"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('poi_content');
</script>

</body>
</html>
